From: Henrik Laxhuber Date: Fri, 20 Apr 2018 15:04:14 +0000 (+0200) Subject: Pass linker path to build script X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~45^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=c4c86bad1301e8b6b9ac0562475831b17f022b32;p=cargo.git Pass linker path to build script This change adds the environment variable LINKER to pass the path of the linker used by cargo to the build script. This ammends the variable RUSTC (the rustc binary used) to give the build script full knowledge of its environment. A specific usage example would be automatically generating bindings to system headers in cross compilation, e.g. by locating jni.h for android targets. --- diff --git a/src/cargo/core/compiler/custom_build.rs b/src/cargo/core/compiler/custom_build.rs index a219ddab5..e1e5ce92a 100644 --- a/src/cargo/core/compiler/custom_build.rs +++ b/src/cargo/core/compiler/custom_build.rs @@ -144,6 +144,7 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoRes .env("HOST", &cx.build_config.host_triple()) .env("RUSTC", &cx.build_config.rustc.path) .env("RUSTDOC", &*cx.config.rustdoc()?) + .env("LINKER", &cx.build_config.target.linker.as_ref().unwrap_or(&PathBuf::new())) .inherit_jobserver(&cx.jobserver); if let Some(links) = unit.pkg.manifest().links() {